#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int N = 100010;
const double eps = 1e-8;

int n, a[N], b[N];

int main() {
    cin >> n;
    double tot = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        tot += (double)a[i]/b[i];
    }

    tot /= 2;

    int i = 1;
    double res = 0;

    while (tot != 0) {
        double temp = (double)a[i]/b[i];
        if (tot > temp) {
            res += a[i++];
            tot -= temp;
        } else {
            res += b[i] * tot;
            break;
        }
    }

    cout << res << endl;
    return 0;
}